<template>
	<div>
		<div class="datadictionary mainCon">
			<div class="containercontent">
				<!--<div class="penalrow selectw100 opabsolute">
					<el-button type="primary" size="mini" @click="addDictionary">添加数据</el-button>
				</div>-->
				<div class="selectw100 seachTip">
					<div class="inlineblock verticalmiddle infoitem">
						<div class="inlineblock verticalmiddle">
							类型名称：
						</div>
						<div class="inlineblock verticalmiddle informationItem">
							<el-input style="" v-model="searchName" size="mini" placeholder="类型名称" @keyup.enter.native="readDictionary(parp,'search')"></el-input>
						</div>
					</div>
					<div class="inlineblock verticalmiddle infoitem">
						<div class="inlineblock verticalmiddle">
							类型编码：
						</div>
						<div class="inlineblock verticalmiddle informationItem">
							<el-input style="" v-model="searchcode" size="mini" placeholder="类型编码" @keyup.enter.native="readDictionary(parp,'search')"></el-input>
						</div>
					</div>
					<div class="inlineblock basicRightDistanceA searchIcon">
						<el-button size="mini" @click="readDictionary(parp,'search')">搜索</el-button>

					</div>
					<div class="inlineblock basicRightDistanceA searchIcon">
						<el-button size="mini" @click="emptySearch">清空</el-button>

					</div>
					<!--<div class="inlineblock selectw100 informationItem">
						<el-button type="primary" size="mini" @click="empty">清空</el-button>
						<el-button type="primary" size="mini" @click="readDictionary('parp')">搜索</el-button>

					</div>-->
				</div>
				<div class="separaterowTable">
					<div class="tableTittle">
						<div><span class="fontImpact">1</span><span>数据字典</span></div>
						<el-button type="primary" icon="el-icon-plus" size="mini" @click="addDictionary" style="float:right" v-if="userOpernation.add.display">添加数据</el-button>
						<!--<el-button type="primary"  size="mini" @click="addMethods" style="float:right">添加方法</el-button>-->
					</div>
					<el-table :data="dictionaryData" style="width: 100%" size="mini" @expand-change="expandChange" @row-click="rowClick" row-key="id"
					 :expand-row-keys="expands" class="tableCon">
						<el-table-column min-width="50px" type="expand">
							<template slot-scope="props">
								<!--{{props.row}}-->
								<el-table :data="dictionaryChild" size='mini' height="200px" style="width:100%;margin:auto;" class="childTable">

									<el-table-column prop="name" label="项目">
									</el-table-column>
									<el-table-column prop="code" label="编码">
									</el-table-column>

									<el-table-column property="genre" label="分类" v-if="props.row.code == 'QC'" :formatter="formatterQcGenre">
									</el-table-column>
									<el-table-column prop="sort" label="排序" width="60px">
									</el-table-column>
									<el-table-column property="remark" label="备注" min-width="180px" :show-overflow-tooltip="true">
									</el-table-column>
									<el-table-column label="操作" min-width="200px">
										<template slot-scope="scope">
											<el-button @click="editDictionaryChild(scope.row,'look')" type="text" size="mini" v-if="userOpernation.select.display">查看</el-button>
											<el-button @click="editDictionaryChild(scope.row,'edit')" type="text" size="mini" v-if="userOpernation.update.display">编辑</el-button>
											<el-button @click.native="deleteAttTypeChild(scope.$index, scope.row)" type="text" size="mini" v-if="userOpernation.delete.display">删除</el-button>
										</template>
									</el-table-column>
								</el-table>
							</template>
						</el-table-column>
						<el-table-column label="序号" width="60px">
							<template slot-scope="scope">
								{{scope.$index+(parp.page - 1) * parp.pageCount + 1}}
							</template>
						</el-table-column>
						<el-table-column property="name" label="类型">
						</el-table-column>
						<el-table-column property="code" label="编码">
						</el-table-column>
						<!--hasParent-->

						<el-table-column property="sort" label="排序" width="60px">
						</el-table-column>
						<el-table-column property="remark" label="备注" width="180px" :show-overflow-tooltip="true" :formatter="util.tableFormatter">
						</el-table-column>
						<el-table-column label="操作" min-width="100px">
							<template slot-scope="scope">
								<el-button @click.stop="editDictionary(scope.row,'look')" type="text" size="mini" v-if="userOpernation.select.display">查看</el-button>
								<el-button @click.stop="editDictionary(scope.row,'edit')" type="text" size="mini" v-if="userOpernation.update.display">编辑</el-button>
								<el-button @click.stop="deleteAttType(scope.$index, scope.row)" type="text" size="mini" v-if="userOpernation.delete.display">删除</el-button>
								<el-button @click.stop="addDictionaryChild(scope.row)" type="text" size="mini" v-if="userOpernation.add.display">添加</el-button>
								<!-- <el-button @click="deleteAttType(scope.row)" type="text" size="mini">删除</el-button> -->
							</template>
						</el-table-column>
					</el-table>
					<div class="block changepages">
						<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="parp.page" :page-sizes="[20, 30, 40]"
						 :page-size="parp.pageCount" layout="total, sizes, prev, pager, next, jumper" :total="rowNumber">
						</el-pagination>
					</div>
				</div>
			</div>
		</div>
		<el-dialog :visible.sync="addDictionaryShow" width="55%" :show-close='false' :closeOnClickModal='false'>
			<span slot="title" class="dialog-title">
		  	{{newOrEdit=='new'?'新增':(newOrEdit=='edit'?'编辑':'查看')}}数据
			    <el-button  size="mini" class="popupClose" @click="resetForm('dectionaryForm')">关闭</el-button>
			  </span>
			<el-form label-width="110px" :inline="false" class="demo-form-inline" :model="dectionaryForm" :rules="dectionaryRules" ref="dectionaryForm">
				<el-form-item label="类型" prop='name'>
					<el-col :span="22">
						<el-input placeholder="类型" size="mini" v-model="dectionaryForm.name" v-if="newOrEdit != 'look'"></el-input>
						<el-input placeholder="类型" size="mini" v-model="dectionaryForm.name" v-if="newOrEdit == 'look'" disabled></el-input>
					</el-col>
				</el-form-item>
				<el-form-item label="编码" prop='code'>
					<el-col :span="22">
						<el-input size="mini" placeholder="编码" v-model="dectionaryForm.code" v-if="newOrEdit != 'look'"></el-input>
						<el-input size="mini" placeholder="编码" v-model="dectionaryForm.code" v-if="newOrEdit == 'look'" disabled></el-input>

					</el-col>
				</el-form-item>
				<el-form-item label="排序" prop='sort'>
					<el-col :span="22">
						<el-input size="mini" placeholder="排序" v-model="dectionaryForm.sort" v-if="newOrEdit != 'look'"></el-input>
						<el-input size="mini" placeholder="排序" v-model="dectionaryForm.sort" v-if="newOrEdit == 'look'" disabled></el-input>
					</el-col>
				</el-form-item>
				<el-form-item label="备注" prop='remark'>
					<el-col :span="22">
						<el-input size="mini" placeholder="备注" v-model="dectionaryForm.remark" v-if="newOrEdit != 'look'"></el-input>
						<el-input size="mini" placeholder="备注" v-model="dectionaryForm.remark" v-if="newOrEdit == 'look'" disabled></el-input>

					</el-col>
				</el-form-item>

			</el-form>

			<span slot="footer" class="dialog-footer" v-if="newOrEdit != 'look'">
			    <el-button type="primary" @click="submitForm('dectionaryForm')" size="mini">确 定</el-button>
			    <el-button  size="mini" @click="resetForm('dectionaryForm')">取 消</el-button>
			  </span>
			<div slot="footer" class="user-footer" v-if="newOrEdit == 'look'">
				<span>
			    	 创建人:{{dectionaryForm.createBy}}
			  	</span>
				<span>
			  		创建时间:{{dectionaryForm.createTime}}
			  	</span>
				<span v-if="dectionaryForm.updateBy != undefined">

			    	 修改人：{{dectionaryForm.updateBy}}
			  	</span>
				<span v-if="dectionaryForm.updateTime != undefined">
			  		修改时间：{{dectionaryForm.updateTime}}
			  	</span>
			</div>

			<!--<span slot="footer" class="dialog-footer user-footer" v-if="newOrEdit == 'look'">
			    	 创建人：
			  </span>-->
		</el-dialog>
		<el-dialog :visible.sync="addDictionaryChildShow" width="55%" :show-close='false' :closeOnClickModal='false'>
			<span slot="title" class="dialog-title">
		  	{{newOrEditChild=='new'?'新增':(newOrEditChild=='edit'?'编辑':'查看')}}项目

			    <el-button  size="mini" class="popupClose" @click="resetChildForm('dectionaryChildForm')">关闭</el-button>
			  </span>
			<el-form label-width="110px" :inline="false" class="demo-form-inline" :model="dectionaryChildForm" :rules="dectionaryChildRules"
			 ref="dectionaryChildForm">

				<el-form-item label="项目" prop="name">
					<el-col :span="22">
						<el-input size="mini" placeholder="项目" v-model="dectionaryChildForm.name" v-if="newOrEditChild != 'look'"></el-input>
						<el-input size="mini" placeholder="项目" v-model="dectionaryChildForm.name" v-if="newOrEditChild == 'look'" disabled></el-input>
					</el-col>
				</el-form-item>

				<el-form-item label="编码" prop="code">
					<el-col :span="22">
						<el-input size="mini" placeholder="编码" v-model="dectionaryChildForm.code" v-if="newOrEditChild != 'look'"></el-input>
						<el-input size="mini" placeholder="编码" v-model="dectionaryChildForm.code" v-if="newOrEditChild == 'look'" disabled></el-input>
					</el-col>
				</el-form-item>
				<el-form-item label="分类" prop="genre" v-if="hasGenre">
					<el-col :span="22">
						<el-select v-model="dectionaryChildForm.genre" placeholder="请选择" size="mini" v-if="newOrEditChild != 'look'" style="width:100%">
							<el-option v-for="item in qcGenre" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
						</el-select>
						<el-select v-model="dectionaryChildForm.genre" placeholder="请选择" size="mini" v-if="newOrEditChild == 'look'" disabled style="width:100%">
							<el-option v-for="item in qcGenre" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
						</el-select>
						<!--<el-input size="mini" placeholder="分类" v-model="dectionaryChildForm.genre"  v-if="newOrEditChild != 'look'"></el-input>-->
						<!--<el-input size="mini" placeholder="分类" v-model="dectionaryChildForm.genre"  v-if="newOrEditChild == 'look'" disabled></el-input>-->
					</el-col>
				</el-form-item>
				<el-form-item label="排序" prop="sort">
					<el-col :span="22">
						<el-input size="mini" placeholder="排序" v-model="dectionaryChildForm.sort" v-if="newOrEditChild != 'look'"></el-input>
						<el-input size="mini" placeholder="排序" v-model="dectionaryChildForm.sort" v-if="newOrEditChild == 'look'" disabled></el-input>
					</el-col>
				</el-form-item>
				<el-form-item label="备注" prop="remark">
					<el-col :span="22">
						<el-input size="mini" placeholder="备注" v-model="dectionaryChildForm.remark" v-if="newOrEditChild != 'look'"></el-input>
						<el-input size="mini" placeholder="备注" v-model="dectionaryChildForm.remark" v-if="newOrEditChild == 'look'" disabled></el-input>
					</el-col>
				</el-form-item>
			</el-form>

			<span slot="footer" class="dialog-footer" v-if="newOrEditChild != 'look'">
			    <el-button type="primary" @click="submitChildForm('dectionaryChildForm')" size="mini" :disabled="!isRepeat">确 定</el-button>
			    <el-button  size="mini" @click="resetChildForm('dectionaryChildForm')">取 消</el-button>
			  </span>
			<div slot="footer" class="user-footer" v-if="newOrEditChild == 'look'">
				<span>
			    	 创建人:{{dectionaryChildForm.createBy}}
			  	</span>
				<span>
			  		创建时间:{{dectionaryChildForm.createTime}}
			  	</span>
				<span v-if="dectionaryChildForm.updateBy != undefined">
			    	 修改人：{{dectionaryChildForm.updateBy}}
			  	</span>
				<span v-if="dectionaryForm.updateTime != undefined">
			  		修改时间：{{dectionaryChildForm.updateTime}}
			  	</span>
			</div>
		</el-dialog>

	</div>
</template>

<script>
	import { mapState } from 'vuex'

	export default {
		data() {
			return {
				searchName: '',
				searchcode: '',
				parp: {
					name: '',
					code: '',
					page: 1,
					pageCount: 20,
				},
				rowNumber: 0,
				addDictionaryShow: false,
				dectionaryForm: {
					name: '',
					code: '',
					remark: '',
					sort: '',
				},
				dectionaryRules: {
					name: [
						{ required: true, type: 'string', message: '请填写类型', trigger: 'blur' },
					],
					code: [{
						required: true, validator: (rule, value, callback) => {
							var reg = /^[a-zA-Z0-9]+$/;
							if (value == '') {
								callback('请填写编码');
							} else if (!reg.test(value)) {
								callback(new Error('编码格式只能为数字或者字母'));
							} else {
								callback();
							}
						}, trigger: 'blur'
					}],
					sort: [{
						validator: (rule, value, callback) => {
							var reg = /^[0-9]+$/;
							if (value == '') {
								callback();
							} else if (!reg.test(value)) {
								callback(new Error('排序格式只能为数字'));
							} else {
								callback();
							}
						}, trigger: 'blur'
					}],
					remark: [{ max: 128, message: '长度最大128个字符', trigger: 'blur' }]
				},
				newOrEdit: 'new',
				dictionaryData: [],
				dictionaryChild: [],
				addDictionaryChildShow: false,
				dectionaryChildForm: {
					type: '',
					name: '',
					code: '',
					remark: '',
					sort: '',
				},
				dectionaryChildRules: {
					name: [
						{ required: true, type: 'string', message: '请填写类型', trigger: 'blur' },
					],
					code: [{ required: true, trigger: 'blur', message: '请填写编码' }],
					genre: [{ required: true, trigger: 'change', message: '请选择分类' }],
					sort: [{
						validator: (rule, value, callback) => {
							var reg = /^[0-9]+$/;
							if (value == '') {
								callback();
							} else if (!reg.test(value)) {
								callback(new Error('排序格式只能为数字'));
							} else {
								callback();
							}
						}, trigger: 'blur'
					}],
					remark: [{ max: 128, message: '长度最大128个字符', trigger: 'blur' }]
				},
				newOrEditChild: 'new',
				expands: [],// 要展开的行，数值的元素是row的key值
				oldRow: null,
				hasGenre: false, //子列表添加是是否显示分类
				qcGenre: [{
					label: "无父样",
					value: 1,
				}, {
					label: "有父样",
					value: 2,
				}, {
					label: "标准样",
					value: 3,
				}],
				isRepeat: true,
			}
		},
		components: {

		},
		computed: {
			...mapState(['enableStatus', 'dataDictionaryType', 'tableHeightA', 'taskTypeTableDate', 'tableHeightD']),
		},
		mounted() {
			this.readDictionary(this.parp)
		},
		props: ['userOpernation'],

		methods: {
			emptySearch() {
				this.searchName = '';
				this.searchcode = '';
				this.readDictionary(this.parp,'search')
			},
			// 转换qc分类数据
			formatterQcGenre(row, column, cellValue, index) {
				return this.util.changeStatus({ cellValue: cellValue, list: this.qcGenre })
			},
			//获取列表
			readDictionary(parp, search) {
				var params = {
					name: this.searchName,
					code: this.searchcode,
				}
				if (search != undefined) {
					this.parp.page = 1
					params.page = 1;
					params.pageCount = parp.pageCount;
				} else {
					params.page = parp.page;
					params.pageCount = parp.pageCount;
				}
				this.$http({
					method: 'post',
					apiUrl: '/system/readDictionaryTypes.htm',
					params: params,
				}).then(res => {
					if (res.code == 0) {
						// 数据变化后重新存储数据字典数据
						res.data.forEach(function (item) {
							item.check = false;
						})
						this.dictionaryData = res.data;
						if (!res.pageinfo) {
							this.rowNumber = 0;
						} else if (res.pageinfo && !res.pageinfo.rowNumber) {
							this.rowNumber = 0;
						} else {
							this.rowNumber = res.pageinfo.rowNumber;
						}
					}

				})
			},
			// 当编辑修改添加删除数据字典数据时重新存储dataDictionaryList
			getDictionaryData() {
				this.$http({
					method: 'post',
					apiUrl: '/system/readDictionary.htm',
				}).then(res => {
					if (res.code == 0) {
						sessionStorage.removeItem('dataDictionaryList');
						sessionStorage.setItem('dataDictionaryList', JSON.stringify(res.data));
					}
				}).catch((err) => {

				});
			},
			resetForm(formName) { //重置表单,关闭表单
				this.$refs[formName].resetFields(); //重置表单
				this.dectionaryForm = {
					name: '',
					code: '',
					remark: '',
					sort: '',
				},
					this.isRepeat = true;
				this.addDictionaryShow = false; //关闭表单

			},
			addDictionary() {
				this.addDictionaryShow = true;
				this.newOrEdit = 'new'
			},
			editDictionary(row, isNew) {
				this.addDictionaryShow = true;
				this.newOrEdit = isNew;
				for (var i in row) { //赋值
					this.dectionaryForm[i] = row[i]
				}
				if (this.dectionaryForm.createTime != undefined) {
					this.dectionaryForm.createTime = this.dectionaryForm.createTime.slice(0, this.dectionaryForm.createTime.indexOf("."));
				}
				if (this.dectionaryForm.updateTime != undefined) {
					this.dectionaryForm.updateTime = this.dectionaryForm.updateTime.slice(0, this.dectionaryForm.updateTime.indexOf("."));
				}




			},
			//提交修改
			submitForm(dectionaryForm) {
				this.$refs[dectionaryForm].validate((valid) => { //表单验证
					if (valid) {
						if (this.newOrEdit == 'new') {
							var url = '/system/addDictionaryType.htm';
							var data = {
								name: this.dectionaryForm.name,
								code: this.dectionaryForm.code,
								remark: this.dectionaryForm.remark,
								sort: this.dectionaryForm.sort,
							};

						} else {
							var url = '/system/updateDictionaryType.htm';
							var data = {
								id: this.dectionaryForm.id,
								name: this.dectionaryForm.name,
								code: this.dectionaryForm.code,
								remark: this.dectionaryForm.remark,
								sort: this.dectionaryForm.sort,
							};
						}
						this.isRepeat = false;
						this.$http({
							method: 'post',
							apiUrl: url,
							params: data,
							isJson: true,
						}).then(res => {
							this.isRepeat = true;
							if (res.code == 0) {
								this.$message({
									type: 'success',
									message: '提交成功!'
								});
								this.readDictionary(this.parp);
								this.getDictionaryData();
								this.resetForm('dectionaryForm');
							}

						}).catch(() => {

						});

					} else {
						return false;
					}
				});

			},
			//删除数据
			deleteAttType(key, row) {
				this.$confirm('是否删除', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					var that = this;
					var param = {
						id: row.id,
					}
					this.$http({
						apiUrl: '/system/deleteDictionaryType.htm',
						type: 'post',
						params: param,
					}).then(res => {
						if (res.code === 0) {
							this.$message({
								type: 'success',
								message: '删除成功!'
							});
							this.readDictionary(this.parp);
							this.getDictionaryData();
						}
					});
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
			},
			handleSizeChange(val) {
				this.parp.pageCount = val;
			},
			handleCurrentChange(val) {
				this.parp.page = val;
			},
			rowClick(row, column,cell,event) {
					Array.prototype.remove = function (val) {
						let index = this.indexOf(val);
						if (index > -1) {
							this.splice(index, 1);
						}
					};
					if (this.expands.indexOf(row.id) < 0) {
						this.expands = [];
						this.expands.push(row.id);
						this.copeId = null;
						var param = {
							id: row.id
						}
						this.$http({
							apiUrl: '/system/readDictionaryTypeById.htm',
							type: 'post',
							params: param,
						}).then(res => {
							if (res.code === 0) {
								this.dictionaryChild = res.data.itemList;
							}
						});
					} else {
						this.expands.remove(row.id);
					}
					delete Array.prototype['remove'];
			},
			//点击一行，获取子表数据
			expandChange(row, expandedRows, operate) {
				if (operate == undefined) {  //点击小三角时operate == undefined  ，operate随意传一个值，不为undefed即可 只刷新展开的能力参数
					if (this.expands.indexOf(row.id) < 0) {
						this.expands = [];
						this.expands.push(row.id);
					} else {
						this.expands.pop(row.id);
					}
				}
				if (expandedRows.length > 1) {
					expandedRows.shift()
				}

				if (this.oldRow && this.oldRow != row) {
					this.oldRow.check = false;
				}
				row.check = !row.check;
				this.oldRow = row;
				if (row.check) {
					var param = {
						id: row.id
					}
					this.$http({
						apiUrl: '/system/readDictionaryTypeById.htm',
						type: 'post',
						params: param,
					}).then(res => {
						if (res.code === 0) {
							this.dictionaryChild = res.data.itemList;
						}
					});
				}

			},
			//添加子列表
			addDictionaryChild(row) {
				this.addDictionaryChildShow = true
				this.newOrEditChild = 'new';
				if (row.code == "QC") {
					this.hasGenre = true;
				} else {
					this.hasGenre = false;
				}
				for (var i in row) {	//赋值
					this.dectionaryForm[i] = row[i]
				}
			},
			//编辑子列表
			editDictionaryChild(row, isNew) {
				if (row.genre !== undefined) {
					this.hasGenre = true;
				} else {
					this.hasGenre = false;
				}
				this.addDictionaryChildShow = true;
				this.newOrEditChild = isNew;
				for (var i in row) { //赋值
					this.dectionaryChildForm[i] = row[i]
				}
				if (this.dectionaryChildForm.createTime != undefined) {
					this.dectionaryChildForm.createTime = this.dectionaryChildForm.createTime.slice(0, this.dectionaryChildForm.createTime.indexOf("."));
				}
				if (this.dectionaryChildForm.updateTime != undefined) {
					this.dectionaryChildForm.updateTime = this.dectionaryChildForm.updateTime.slice(0, this.dectionaryChildForm.updateTime.indexOf("."));
				}

			},
			//提交子列表修改和添加
			submitChildForm(dectionaryChildForm) {
				this.$refs[dectionaryChildForm].validate((valid) => { //表单验证
					if (valid) {
						if (this.newOrEditChild == 'new') {
							var url = '/system/addDictionaryItem.htm';
							var data = {
								type: this.dectionaryForm.id,
								name: this.dectionaryChildForm.name,
								code: this.dectionaryChildForm.code,
								remark: this.dectionaryChildForm.remark,
								sort: this.dectionaryChildForm.sort,
								genre: this.dectionaryChildForm.genre
							};
							var sendId = { id: this.dectionaryForm.id }
						} else {
							var url = '/system/updateDictionaryItem.htm';
							var data = {
								id: this.dectionaryChildForm.id,
								type: this.dectionaryChildForm.type,
								name: this.dectionaryChildForm.name,
								code: this.dectionaryChildForm.code,
								remark: this.dectionaryChildForm.remark,
								sort: this.dectionaryChildForm.sort,
								genre: this.dectionaryChildForm.genre,
							};
							var sendId = { id: this.dectionaryChildForm.type }
						}
						this.isRepeat = false;
						this.$http({
							method: 'post',
							apiUrl: url,
							params: data,
							isJson: true,
						}).then(res => {
							this.isRepeat = true;
							if (res.code == 0) {
								this.$message({
									type: 'success',
									message: '提交成功!'
								});
								this.expandChange(sendId, sendId, 'operate');
								this.getDictionaryData();
								this.resetChildForm('dectionaryChildForm');

							}

						}).catch(() => {

						});

					} else {
						return false;
					}
				});

			},
			resetChildForm(formName) {
				this.$refs[formName].resetFields(); //重置表单
				this.dectionaryForm = {
					name: '',
					code: '',
					remark: '',
					sort: '',

				};
				this.dectionaryChildForm = {
					name: '',
					code: '',
					sort: '',
					remark: '',
					genre: '',
				};
				this.addDictionaryChildShow = false; //关闭表单
				this.isRepeat = true;

			},
			//删除子列表数据
			deleteAttTypeChild(key, row) {
				this.$confirm('是否删除', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					var that = this;
					var param = {
						id: row.id,
					}
					this.$http({
						apiUrl: '/system/deleteDictionaryItem.htm',
						type: 'post',
						params: param,
					}).then(res => {
						if (res.code === 0) {
							this.$message({
								type: 'success',
								message: '删除成功!'
							});
							this.expandChange({ id: row.type }, { id: row.type }, 'operate')
							this.getDictionaryData();
						}
					});
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
			},

		},
		watch: {
			parp: {
				handler(val, oldVal) {
					this.readDictionary(this.parp)
				},
				deep: true
			},
		},
	}

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
	/*.datadictionary  .gutter{
		display: block !important;
	}*/

	.datadictionary th.gutter {
		display: table-cell!important;
	}
</style>
<style scoped>
	.seachTip .infoitem {
		width: calc(100%/3);
	}

	.seachTip .informationItem {
		width: calc(100% - 100px);
		float: none;
		margin-left: 8px;
	}
	/*.datadictionary .infoitem {
		width: calc((100% - 200px)/3);
		padding: 0;
		margin-right: 5px;
	}*/
	/*.informationItem {
		width: calc(100% - 78px);
		float: none;
		margin-left: 8px;
		}*/
	/*.datadictionary .informationItem {
		float: none;
		width: 300px;
	}*/
</style>
